package com.yanfan.parking;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.yanfan.common.utils.http.HttpUtils;
import com.yanfan.ibms.common.utils.HttpUtil;
import com.yanfan.ibms.common.utils.HttpUtils2;
import com.yanfan.parking.domain.IbmsParkingPlace;

import java.util.HashMap;
import java.util.List;

public class test {
    public static void main(String[] args) {
        // 发送POST请求
        HashMap<String, Object> stringObjectHashMap = new HashMap<>();
        stringObjectHashMap.put("stationNo","59");

        JSONObject jsonObject = HttpUtils2
                .sendPostBody("http://10.22.10.249:9988/Parking/Handheld/GetParkingLotInfo",null, stringObjectHashMap);
        Object object = jsonObject.get("parkingLotInfo");
        List<IbmsParkingPlace> list = JSON.parseArray(object.toString(), IbmsParkingPlace.class);
        for (IbmsParkingPlace ibmsParkingPlace : list) {
            ibmsParkingPlace.setChargeRuleDesc(jsonObject.get("chargeRuleDesc").toString());
        }
        System.out.println(list);
    }
}
